import os

from utils.helper import load_yaml
from utils.enums import Language
from utils.paths import RootPath

L = {
    Language.CN: load_yaml(os.path.join(RootPath, "utils", "i18n", "cn.yaml")),
    Language.EN: load_yaml(os.path.join(RootPath, "utils", "i18n", "en.yaml")),
}

def i18n(language: Language, key: str) -> str:
    return L[language].get(key, "Error: Not Found Translate.")